package com.qidian.mes.tools.controller;

import com.qidian.common.pojo.MESResult;
import com.qidian.mes.pojo.ToolType;
import com.qidian.mes.tools.service.ToolsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.awt.*;

/**
 * @Author 任超
 * Time 2024/10/19 13:45
 */
@RestController
@RequestMapping("/type")
@CrossOrigin
public class ToolsTypeController {

    @Autowired
    private ToolsTypeService toolsTypeService;

    @GetMapping("/list")
    public MESResult list(ToolType toolType, @RequestParam(defaultValue = "1")int page,@RequestParam(defaultValue = "10")int limit){
        return toolsTypeService.selectList(toolType,page,limit);
    }

    @PutMapping("/add")
    public MESResult addToolType(@RequestBody ToolType toolType){
        return toolsTypeService.addToolType(toolType);
    }

    @PutMapping("/delete")
    public MESResult deleteToolType(Long toolTypeId){
        return toolsTypeService.delete(toolTypeId);
    }

    @PutMapping("/updateType")
    public MESResult updateType(@RequestBody ToolType toolType){
        return toolsTypeService.updateType(toolType);
    }

    @GetMapping("/selectById")
    public MESResult selectById(Long toolTypeId){
        return toolsTypeService.selectToolType(toolTypeId);
    }
}
